#include <iostream>
using namespace std;
//
//
//int globalVar = 1;
//static int staticGlobalVar = 1;
//void Test()
//{
//	static int staticVar = 1;
//	int localVar = 1;
//	int num1[10] = { 1, 2, 3, 4 };
//	char char2[] = "abcd";
//	const char* pChar3 = "abcd";
//	int* ptr1 = (int*)malloc(sizeof(int) * 4);
//	int* ptr2 = (int*)calloc(4, sizeof(int));
//	int* ptr3 = (int*)realloc(ptr2, sizeof(int) * 4);
//	free(ptr1);
//	free(ptr3);
//	
//	
//}
#include <vector>
class Solution {
public:
    vector<vector<int>> generate(int numRows)
    {
        vector<vector<int>> ret;
        ret[0][0] = 1;
        for (int i = 1; i < numRows; i++)
        {
            for (int j = 0; j < i; j++)
            {
                if (j == 0 || i == j)
                    ret[i][j] = 1;
                else
                    ret[i][j] = ret[i][j - 1] + ret[i - 1][j - 1];
            }
        }

        return ret;
    }
};

int main()
{
    Solution s;
    auto ret = s.generate(5);
    for (int i = 0; i < ret.size(); i++)
    {
        for (int j = 0; j < ret[0].size(); j++)
        {
            cout << ret[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}